﻿@using Abp.Application.Services.Dto
@using Magicodes.Admin.Web.Areas.Admin.Models.Common.Modals
@using Magicodes.Admin.Web.Areas.Admin.Models.Languages
@model CreateOrEditLanguageModalViewModel

@Html.Partial("~/Areas/Admin/Views/Common/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(Model.IsEditMode ? (L("EditLanguage") + ": " + Model.Language.Name) : L("CreateNewLanguage")))

<div class="modal-body">
    <form name="LanguageInformationsForm" role="form" novalidate class="form-validation">
        @if (Model.IsEditMode)
        {
            <input type="hidden" name="Id" value="@Model.Language.Id"/>
        }

        <div class="form-group">
            <label for="LanguageNameEdit">@L("Language")</label>
            @Html.DropDownList(
                "Name",
                Model.LanguageNames.Select(i => i.ToSelectListItem()),
                new
                {
                    @class = "form-control selectpicker",
                    data_live_search = "true",
                    id = "LanguageNameEdit"
                })
        </div>
        <div class="form-group">
            <label for="LanguageIconEdit">@L("Flag")</label>
            <select id="LanguageIconEdit" name="Icon" class="form-control bs-select" data-live-search="true">
                @foreach (var flag in Model.Flags)
                {
                    <option data-icon="@flag.Value" value="@flag.Value" selected="@flag.IsSelected"><i class="@flag.Value"></i>@flag.DisplayText</option>
                }
            </select>
        </div>
        
        <div class="md-checkbox-list">
            <div class="md-checkbox">
                <input id="EditLanguage_IsEnabled" class="md-check" type="checkbox" name="IsEnabled" value="true" @(Model.Language.IsEnabled ? "checked=\"checked\"" : "") />
                <label for="EditLanguage_IsEnabled">
                    <span class="inc"></span>
                    <span class="check"></span>
                    <span class="box"></span>
                    @L("IsEnabled")
                </label>
            </div>
        </div>

    </form>
</div>

@Html.Partial("~/Areas/Admin/Views/Common/Modals/_ModalFooterWithSaveAndCancel.cshtml")
